﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Diagnostics;

namespace MVCnExt.Web.UI.Ext
{
    public static class ReflXtPropertyInfo
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <param name="source"></param>
        /// <param name="obj"></param>
        public static object GetRedValue(this PropertyInfo source, object obj)
        {
            return new FastProperty(source).GetDelegate.Invoke(obj);
        }

        public static P GetRedValue<T, P>(this PropertyInfo source, T obj)
        {
            return new FastProperty<T, P>(source).GetDelegate.Invoke(obj);
        }

        public static object GetRedValue<T>(this PropertyInfo source, T obj)
        {
            return new FastProperty<T>(source).GetDelegate.Invoke(obj);
        }

    }
}
